import { BirdLevelType, GameState } from "./GameConst";


export class GameData {

    private static _instance: GameData = null;
    public static get instance(): GameData {
        if (this._instance == null) {
            this._instance = new GameData();
        }
        return this._instance;
    }

    public curScore: number = 0;
    public bestScore: number = 0;
    public curBirdLevel: BirdLevelType = BirdLevelType.BLT_Yello;
    public curGameState: number = GameState.GS_GameReady;
    

    public getBirdLevel(): BirdLevelType {

        if(this.curScore >= 50){
            this.curBirdLevel = BirdLevelType.BLT_Red;
        }else if(this.curScore >= 20){
            this.curBirdLevel = BirdLevelType.BLT_Blue;
        }else{
            this.curBirdLevel = BirdLevelType.BLT_Yello;
        }

        return this.curBirdLevel;
    }

    public restGameData(){
        this.curScore = 0;
        this.curBirdLevel = BirdLevelType.BLT_Yello;
    }
}